package com.zhuiyun.project.api.appusermessage.service.impl;

import com.zhuiyun.project.api.appusermessage.entity.Disease;
import com.zhuiyun.project.api.appusermessage.mapper.DiseaseMapper;
import com.zhuiyun.project.api.appusermessage.service.DiseaseService;
import com.zhuiyun.project.common.response.CommonResult;
import com.zhuiyun.project.util.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName DiseaseServiceImpl
 * @Description TODO
 * @Author Root
 * @Date 2023/6/28 14:30
 **/
@Service
public class DiseaseServiceImpl implements DiseaseService {
    @Autowired
    DiseaseMapper diseaseMapper;
    /**
    * @Author Root
    * @Description 通过id查询病种信息
    * @Date 2023/6/28 14:34
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param dicId
    */
    @Override
    public CommonResult getDiseaseById(Integer dicId) {
        //判断id是否为空
        if (ObjectUtils.isNotEmpty(dicId)) {
            //获取病种信息
            List<Disease> diseaseById = diseaseMapper.getDiseaseById(dicId);
            return CommonResult.ok(diseaseById);
        } else {
            return CommonResult.error();
        }
    }

    /**
    * @Author kdj
    * @Description 根据病例id获取病例Label
    * @Date 2023/7/27 19:01
    * @Return java.lang.String
    * @param dataId
    */
    @Override
    public String getDiseaseLabel(Integer dataId) {
        return diseaseMapper.getDiseaseLabel(dataId);
    }
}
